<template>
	<view class="content">
		
		<view style="background-color: rgb(230, 230, 230); height: 32px;">
			
			<view style="font-size: 16px; padding-top: 4px; padding-left: 8px;">商品基础信息</view>
		</view>
		<u--form 
			labelPosition="left"
			labelWidth="80px"
			labelStyle="{'fontSize':'10px'}"
			labelAlign="center"
			v
		>
			<u-form-item label="商品名称">
				<text>{{goodObject.goodName}}</text>
			</u-form-item>
			
			<u-form-item label="编号">
				<text>{{goodObject.goodNo}}</text>
			</u-form-item>
			
			<u-form-item label="商品分类">
				<text>{{goodObject.goodTypeText}}</text>
			</u-form-item>
			<u-form-item label="库存" v-if="goodObject.goodType==='SOURCE'">
				<text>{{goodObject.inventory}}</text>
			</u-form-item>
			
			<u-form-item label="原料种类" v-if="goodObject.goodType==='SOURCE'">
				<text>{{goodObject.sourceTypeText}}</text>
			</u-form-item>
			
			<u-form-item label="单位">
				<text>{{goodObject.unitText}}</text>
			</u-form-item>
			
			<u-form-item label="品相">
				<text>{{goodObject.goodCondtionText}}</text>
			</u-form-item>
			
			<u-form-item label="规格">
				<text>{{goodObject.goodSpecificText}}</text>
			</u-form-item>
			
			<u-form-item label="零售价">
				<text>{{goodObject.retailPrice}}</text>
			</u-form-item>
		</u--form>
		
		 <u-collapse
			v-if="goodObject.goodType==='MAKED'"
		  >
			   <u-collapse-item
					title="关联商品"
					name="Good Related"
				  >
					<u-row  v-for="item in goodObject.goodRelateDtoList" custom-style="margin-top:10px;">
						<u-col span="7">商品名：{{item.sourceGoodName}}</u-col>
						<u-col span="3">数量：{{item.relateCount}}</u-col>
					</u-row>
				  </u-collapse-item>
		  </u-collapse>
	</view>
</template>

<script>
	import {loadById} from '@/api/good.js'
	export default{
		onLoad(options) {
			this.goodId=options.goodId;
			this.loadByGoodId();
		},
		data(){
			return{
				goodId:undefined,
				goodObject:{}
			}
		},
		methods:{
			loadByGoodId(){
				let that=this;
				loadById(this.goodId).then(res=>{
					that.goodObject=res.data;
					console.log(res);
				});
			}
		}
	}
</script>

<style>
</style>